<template>
  <div>
    <!-- 添加或修改练习对话框 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="visible" :before-close="beforeClose" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入名称"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="单号" prop="code">
              <el-input v-model="form.code" placeholder="请输入单号"/>
            </el-form-item>
          </el-col>
          <el-form-item label="日期" prop="date">
            <el-date-picker clearable
                            v-model="form.date"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="请选择日期">
            </el-date-picker>
          </el-form-item>
          <el-col :span="12">
            <el-form-item label="对应业务id" prop="businessId">
              <el-input v-model="form.businessId" placeholder="请输入对应业务id"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="客户id/供应商id" prop="customerId">
              <el-input v-model="form.customerId" placeholder="请输入客户id/供应商id"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款方式" prop="payment">
              <el-input v-model="form.payment" placeholder="请输入付款方式"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="数量" prop="number">
              <el-input v-model="form.number" placeholder="请输入数量"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="金额" prop="money">
              <el-input v-model="form.money" placeholder="请输入金额"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="删除标志" prop="delFlag">
              <el-input v-model="form.delFlag" placeholder="请输入删除标志"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submit">确 定</el-button>
        <el-button @click="beforeClose">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {practice} from "@/api/business/practice";
import {editMixin} from '@/mixins/edit'

export default {
  name: "Practice",
  mixins: [editMixin],
  data() {
    return {
      //数据校验规则
      rules: {}
    };
  },
  props: {},
  created() {

  },
  methods: {
    //调用save接口
    callSave(form) {
      return new Promise(function (resolve, reject) {
        practice.save(form).then((res) => {
          resolve(res);
        }).catch((error) => {
          reject(error)
        });
      });
    },
  }
};
</script>
